#include "hashTable.h"
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>

int main(int argc, char* argv[]) {
	assert(argc == 2);

	char* inputFileName = argv[1];

	char line[MAX_LINE_LENGTH];

	FILE* inputFile = fopen(inputFileName, "r");
	assert (inputFile != NULL);

	int lineCount = 0;

	while(fgets(line, sizeof(line), inputFile)) {		
		add(line);			
		lineCount++;	
	}

	while (true) {
		scanf("%s", line);

		if (strcmp(line, "exit") == 0) {
			return 0;
		}
		
		printf("%s\n", find(line) ? "YES" : "NO");
	}	
}